import request from "@/net/HttpRequest";
import * as Url from "@/net/Url";
import {QUERY_APPLYED_BOX_URL} from "@/net/Url";

/**
 * 获取openid
 */
export function getOpenidRequest(data = {}) {
    return request({
        url: Url.GET_OPENID_URL,
        method: 'POST',
        data
    });
}

/**
 * 通过openid查询状态
 */
export function getStatusRequest(data = {}) {
    return request({
        url: Url.GET_STATUS_URL,
        method: 'GET',
        data
    });
}

/**
 * 登录
 */
export function loginRequest(data = {}) {
    return request({
        url: Url.LOGIN_URL,
        method: 'POST',
        data
    });
}

/**
 * 生成 RUser 数据(获取用户id)
 */
export function getUserReuqest(data = {}) {
    return request({
        url: Url.GETUSER_URL,
        method: 'POST',
        data
    });
}

/**
 * 查询用户人脸照片信息
 */
export function getUserFaceReuqest(data = {}) {
    return request({
        url: Url.GET_USER_FACE_URL + `?id=${data.id}`,
        method: 'POST',
        data
    });
}

/**
 * 查询部门及父部门名称
 */
export function queryParentName(data = {}) {
    return request({
        url: Url.QUERY_PARENT_NAME_URL + `?id=${data.id}`,
        method: 'POST',
        data: {}
    });
}

/**
 * 获取部门下所有的岗位
 */
export function getPostByDeptId(data = {}) {
    return request({
        url: Url.GET_POST_BY_DEPTID_URL + `?id=${data.id}`,
        method: 'POST',
        data: {}
    });
}

/**
 * 提交配置信息
 */
export function commitConfigRequest(data = {}) {
    return request({
        url: Url.CONFIG_URL,
        method: 'POST',
        data
    });
}

/**
 * 获取字典信息
 */
export function getDictRequest(data = {}) {
    return request({
        url: Url.GETDICT_URL + `?dictCode=${data.dictCode}`,
        method: 'POST',
        // data
    });
}

/**
 * 获取列表
 */
export function getListRequest(data = {}) {
    return request({
        url: Url.GET_LIST_URL,
        method: 'POST',
        data
    });
}

/**
 * 任务查询详情
 */
export function getDetailsRequest(data = {}) {
    return request({
        url: Url.QUERY_DETAILS_URL + `?id=${data.id}`,
        method: 'POST',
        data
    });
}

/**
 * 上传文件
 */
export function uploadFile(data = {}) {
    return request({
        url: Url.UPLOAD_FILE_URL,
        method: 'POST',
        data,
        isFileUpload: true,
    });
}

/**
 * 查询用户信息
 */
export function queryUserInfoRequest(data = {}) {
    return request({
        url: Url.QUERY_USER_INFO_URL + `?id=${data.id}`,
        method: 'POST',
    });
}

/**
 * 修改用户信息
 */
export function updateUserInfoRequest(data = {}) {
    return request({
        url: Url.UPDATE_USER_INFO_URL,
        method: 'POST',
        data
    });
}

/**
 * 修改密码
 */
export function modifyPasswordRequest(data = {}) {
    return request({
        url: Url.MODIFY_PASSWORD_URL,
        method: 'POST',
        data
    });
}

/**
 * 获取款箱任务列表
 */
export function getTaskListRequest(data = {}) {
    return request({
        url: Url.GET_TASK_LIST_URL,
        method: 'POST',
        data
    });
}

/**
 * 款箱管理  查询列表
 */
export function cashBoxQueryListRequest(data = {}) {
    return request({
        url: Url.GET_POINT_LIST_URL,
        method: 'POST',
        data,
    });
}

/**
 * 新增款箱申请
 */
export function addTaskRequest(data = {}) {
    return request({
        url: Url.ADD_TASK_URL,
        method: 'POST',
        data
    });
}

/**
 * 修改款箱申请
 */
export function modifyTaskRequest(data = {}) {
    return request({
        url: Url.MODIFY_TASK_URL,
        method: 'POST',
        data
    });
}

/**
 * 撤回款箱申请
 */
export function reBackTaskRequest(data = {}) {
    return request({
        url: Url.REBACK_TASK_URL+`?id=${data.id}`,
        method: 'POST',
        // data
    });
}

/**
 * 根据id查询任务申请的款箱
 */
export function queryApplyedBoxRequest(data = {}) {
    return request({
        url: Url.QUERY_APPLYED_BOX_URL+`?id=${data.id}`,
        method: 'POST',
        // data
    });
}

/**
 * 获取款箱数量
 */
export function getBoxCountReuqest(data = {}) {
    return request({
        url: Url.GET_BOX_COUNT_URL + `?id=${data.id}`,
        method: 'POST',
        data: {}
    });
}
